import request from '@/router/axios';

export class Http {
  post(url , body , params , option){
    option = option || {};
    return request({
      url: url,
      method: 'post',
      ...option,
      data: body || {},
      params: params || {}
    });
  }
  put(url , body , params , option){
    option = option || {};
    return request({
      url: url,
      method: 'put',
      ...option,
      data: body || {},
      params: params || {}
    });
  }

  delete(url , params , option){
    option = option || {};
    return request({
      url: url,
      method: 'delete',
      ...option,
      params: params || {}
    });
  }

  get(url , params , option){
    option = option || {};
    return request({
      url: url,
      method: 'get',
      ...option,
      params: params || {}
    });
  }
}